/*!
\copyright  Copyright (c) 2023 - 2024 Qualcomm Technologies International, Ltd.\n
            All Rights Reserved.\n
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file       
\brief      Events sent by the audio stack module and its components
*/

#ifndef AUDIO_STACK_CHANNEL_EVENT_SPEC_H_
#define AUDIO_STACK_CHANNEL_EVENT_SPEC_H_

#include "channel_event_spec_ids.h"
#include <audio_stack_use_cases.h>

#define AUDIO_STACK_IS_USECASE_STREAMING(usecase) (usecase == USE_CASE_STREAMING)
#define AUDIO_STACK_IS_USECASE_VOICE(usecase) (usecase == USE_CASE_VOICE_RECEIVE || usecase == USE_CASE_VOICE_SEND)

/*! @{ */

/*! \brief The audio stack event channel */
#define EVENT_BUS_CHANNEL_AUDIO_STACK  audio_stack_event_channel

/*! \brief The common data sent with the audio stack events. */
typedef struct
{
    audio_stack_use_cases_t use_case;
    uint32_t instance;
} audio_stack_event_common_data_t;

/*! \brief The audio stack events that are sent. */
typedef enum
{
    /*! Send after a use case is prepared */
    audio_stack_event_usecase_prepare,
    /*! Send after a use case is started */
    audio_stack_event_usecase_start,
    /*! Send after a use case is stopped or aborted */
    audio_stack_event_usecase_stop,
    /*! Used to indicate the number of audio_stack_events */
    audio_stack_event_max,
} audio_stack_channel_event_t;

/*! \brief The data sent with the audio_stack_event_usecase_prepare event */
typedef struct
{
    audio_stack_event_common_data_t common;
} audio_stack_event_usecase_prepare_t;

/*! \brief The data sent with the audio_stack_event_usecase_start event */
typedef struct
{
    audio_stack_event_common_data_t common;
} audio_stack_event_usecase_start_t;

/*! \brief The data sent with the audio_stack_event_usecase_stop event */
typedef struct
{
    audio_stack_event_common_data_t common;
    /*! TRUE if the use case was aborted, FALSE if the stop was requested
     *  Where stop refers to the use case being explicitly stopped by the user,
     *  while abort refers to it being terminated implicitly due to some conflict with a higher priority use case
     */
    unsigned aborted:1;
} audio_stack_event_usecase_stop_t;

/*! @} */

#endif /* AUDIO_STACK_CHANNEL_EVENT_SPEC_H_ */
